<?php 
$siteurl = ($_SERVER['SERVER_PORT'] == '443' ? 'https://' : 'http://') . $_SERVER['HTTP_HOST']. '/';//获取本地域名
$allapi	 = $siteurl;//QQ快捷登录API地址
session_start();
include("../Core/Core_Class/Oauth.class.php");
$path = 'qqlogin';
$Oauth = new Oauth();
header("Content-Type: text/html; charset=UTF-8");
if ($_GET['code']) {
    $array = $Oauth->callback('zero2109877665');
    $_SESSION['social_uid']	  		=	 $array['social_uid'];//固定值 可作为账号
    $_SESSION['access_token'] 		=	 $array['access_token'];//固定值 可作为密码
    $_SESSION['gender']		  		=	 $array['gender'];//性别
	$_SESSION['nickname'] 			=	 $array['nickname'];//QQ名称
    $_SESSION['figureurl_qq_1']	    =	 $array['figureurl_qq_1'];//大小为40×40像素的QQ头像URL
    $_SESSION['figureurl_qq_2']		=	 $array['figureurl_qq_2'];//[大小为100×100像素的QQ头像URL。不是所有的用户都拥有QQ的100×100的头像。]
	$_SESSION['vip']	 	 		=	 $array['vip'];//标识用户是否为黄钻用户（0：不是；1：是）
    $_SESSION['level']				=	 $array['level'];//黄钻等级
	$_SESSION['is_yellow_year_vip'] = $array['is_yellow_year_vip'];//标识是否为年费黄钻用户（0：不是； 1：是）
	
	echo '用户：'.$_SESSION['social_uid'].'<br>';
	
	echo '密码：'.$_SESSION['access_token'].'<br>';
	
	echo '性别：'.$_SESSION['gender'].'<br>';
	
	echo '名称：'.$_SESSION['nickname'].'<br>';
	
	echo '40X40头像URL：'.$_SESSION['figureurl_qq_1'].'<br>';
	
	echo '100X100头像URL：'.$_SESSION['figureurl_qq_2'].'<br>';
	
	echo '是否黄钻：'.($_SESSION['vip'] ? '黄钻用户' : '非黄钻用户').'<br>';
	
	echo '黄钻等级：'.($_SESSION['level'] ? $level : '非黄钻用户').'<br>';
	
	echo '年费黄钻：'.($_SESSION['is_yellow_year_vip'] ? '是年费' : '非年费').'<br>';
	
	setcookie("qqlogin_token", md5($_SESSION['social_uid'].$_SESSION['access_token']), time() + 9, '/');
} else {
	setcookie("qqlogin_token", "", time() - 9, '/');
	unset($_SESSION['social_uid']);//注销变量
	unset($_SESSION['access_token']);//注销变量
		$Oauth->login();
	
}